package com.bdqn.spark.chapter05.value

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark12_RDD_Operator_Transform {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf()
      .setMaster("local[*]")
      .setAppName("operator-repartition")
    val sc = new SparkContext(sparkConf)

    val sourceRDD: RDD[Int] = sc.makeRDD(List(1, 36, 4, 5, 72, 3), 2)
    // (1, 36, 5) (4, 72, 3)
    // (1,3,4) (5,36,72)
    //    sourceRDD.sortBy(ele => ele).collect.foreach(println)
    sourceRDD.sortBy(ele => ele, false).saveAsTextFile("output")

    sc.stop()
  }
}
